import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      redirect: "/login"
    },


    {
      path: '/home',
      name: 'home',
      redirect: '/home/settings',
      component: HomeView,
      children: [
        
        {
          path: "/home/settings",
          name: 'settings',
          component: () => import('../views/SettingsView.vue'),
        },
        {
          path: "/home/main",
          name: "main",
          component: () => import('../views/MainView.vue'),
        },
        {
          path: "/home/usergroup",
          name: "usergroup",
          component: () => import('../views/UserGroupView.vue'),
        },
        
        {
          path: "/home/user",
          name: "user",
          component: () => import('../views/UserView.vue'),
        }
       
      ]

    },
    {
      path: '/login',
      name: 'login',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/LoginView.vue')
    }
  ]
})

export default router
